// 帖子加精 | 取消加精
$(function () {
    $(".highlight-btn").click(function () {
       var self =$(this);
       var tr = self.parent().parent();
       var post_id = tr.attr('data-id');
       var highlight = parseInt(tr.attr('data-highlight'));
       var url="";
       if(highlight){
           url = '/cms/unhpost/';
       }else{
           url = '/cms/hpost/'
       }
       zlajax.post({
          'url':url,
          'data':{
              'post_id':post_id,
          },
           'success':function (data) {
               if(data['code']==200){
                   zlalert.alertSuccessToast("操作成功！");
                   setTimeout(function () {
                      window.location.reload();
                   },500);
               }else{
                   zlalert.alertInfo(data['message']);
               }
           }
       });
    });
});

$(function () {
    $(".delete-btn").click(function () {

        var self = $(this);
        var tr = self.parent().parent();
        var post_id = tr.attr('data-id');
        zlajax.post({
           'url':'/cms/dposts/',
           'data':{
               'post_id':post_id
           },
            'success':function (data) {
                if(data['code']==200){
                    zlalert.alertInfoToast("删除成功");
                    setTimeout(function () {
                        window.location.reload();
                    },500)
                }else{
                    zlalert.alertInfo(data['message']);
                }
            }
        });
    });
});